<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>WLog: BlockOuter.cpp源文件</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- 制作者 Doxygen 1.5.8 -->
<script type="text/javascript">
<!--
function changeDisplayState (e){
  var num=this.id.replace(/[^[0-9]/g,'');
  var button=this.firstChild;
  var sectionDiv=document.getElementById('dynsection'+num);
  if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){
    sectionDiv.style.display='block';
    button.src='open.gif';
  }else{
    sectionDiv.style.display='none';
    button.src='closed.gif';
  }
}
function initDynSections(){
  var divs=document.getElementsByTagName('div');
  var sectionCounter=1;
  for(var i=0;i<divs.length-1;i++){
    if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){
      var header=divs[i];
      var section=divs[i+1];
      var button=header.firstChild;
      if (button!='IMG'){
        divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild);
        button=document.createElement('img');
        divs[i].insertBefore(button,divs[i].firstChild);
      }
      header.style.cursor='pointer';
      header.onclick=changeDisplayState;
      header.id='dynheader'+sectionCounter;
      button.src='closed.gif';
      section.id='dynsection'+sectionCounter;
      section.style.display='none';
      section.style.marginLeft='14px';
      sectionCounter++;
    }
  }
}
window.onload = initDynSections;
-->
</script>
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>首页</span></a></li>
      <li><a href="namespaces.html"><span>名字空间</span></a></li>
      <li><a href="annotated.html"><span>类</span></a></li>
      <li class="current"><a href="files.html"><span>文件</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>文件列表</span></a></li>
      <li><a href="globals.html"><span>文件成员</span></a></li>
    </ul>
  </div>
<h1>BlockOuter.cpp</h1><a href="BlockOuter_8cpp.html">浏览该文件的文档。</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#include "<a class="code" href="BlockOuter_8h.html">BlockOuter.h</a>"</span>
<a name="l00002"></a>00002 <span class="preprocessor">#include "<a class="code" href="ILevel_8h.html">ILevel.h</a>"</span>
<a name="l00003"></a>00003 <span class="preprocessor">#include "<a class="code" href="Record_8h.html">Record.h</a>"</span>
<a name="l00004"></a>00004 <span class="preprocessor">#include "<a class="code" href="Common_8h.html">Common.h</a>"</span>
<a name="l00005"></a>00005 
<a name="l00006"></a><a class="code" href="namespaceWLog.html">00006</a> <span class="keyword">namespace </span>WLog
<a name="l00007"></a>00007 {
<a name="l00008"></a><a class="code" href="classWLog_1_1BlockOuter.html#6e9311483911009ec3cd3ea838824fad">00008</a>     <a class="code" href="classWLog_1_1BlockOuter.html#6e9311483911009ec3cd3ea838824fad">BlockOuter::BlockOuter</a>(ostream &amp;out)
<a name="l00009"></a>00009         : <a class="code" href="classWLog_1_1RegularOuter.html" title="对IOuter实现正规的格式输出">RegularOuter</a>(out)
<a name="l00010"></a>00010     {
<a name="l00011"></a>00011 
<a name="l00012"></a>00012     }
<a name="l00013"></a>00013 
<a name="l00014"></a><a class="code" href="classWLog_1_1BlockOuter.html#1b087dac8dfb630c494d474b5384d7a5">00014</a>     <a class="code" href="classWLog_1_1BlockOuter.html#1b087dac8dfb630c494d474b5384d7a5">BlockOuter::~BlockOuter</a>()
<a name="l00015"></a>00015     {
<a name="l00016"></a>00016 
<a name="l00017"></a>00017     }
<a name="l00018"></a>00018 
<a name="l00019"></a><a class="code" href="classWLog_1_1BlockOuter.html#88b3661c3ac239f1b12d9e1af4dd720a">00019</a>     <span class="keywordtype">bool</span> <a class="code" href="classWLog_1_1BlockOuter.html#88b3661c3ac239f1b12d9e1af4dd720a" title="输出Record记录与Record对应的Level.">BlockOuter::outRecord</a>(<a class="code" href="classWLog_1_1Record.html" title="记录类，记录一条信息的所有字段。">Record</a> *pRecord, <a class="code" href="classWLog_1_1ILevel.html" title="Define Interface for Log Level.">ILevel</a> *pLevel)
<a name="l00020"></a>00020     {
<a name="l00021"></a>00021 <span class="preprocessor">#define STRING_TABLE_LINE "+--------------------------------------------------+"</span>
<a name="l00022"></a>00022 <span class="preprocessor"></span><span class="preprocessor">#define STRING_TABLE_START "+ "</span>
<a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define STRING_TABLE_END " +"</span>
<a name="l00024"></a>00024 <span class="preprocessor"></span><span class="preprocessor">#define STRING_TABLE_SPLIT " | "</span>
<a name="l00025"></a>00025 <span class="preprocessor"></span>        <span class="keywordflow">if</span> (!pLevel-&gt;<a class="code" href="classWLog_1_1ILevel.html#995896554a53b1e03c0617a36d3b3afc" title="回调函数，在输出前调用，对此级别Log Record 提前处理.">callBack_BeforeOut</a>(pRecord, <span class="keyword">this</span>))
<a name="l00026"></a>00026         {
<a name="l00027"></a>00027             <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00028"></a>00028         }
<a name="l00029"></a>00029         
<a name="l00030"></a>00030         <span class="keywordflow">if</span> (pLevel-&gt;<a class="code" href="classWLog_1_1ILevel.html#c5ee0c8e7bd470d233535d45655d889e" title="是否要输出“名称”">bOutName</a>())
<a name="l00031"></a>00031         {
<a name="l00032"></a>00032             <a class="code" href="classWLog_1_1RegularOuter.html#00bb054fa8cf40d3d2d32ba4c7cfbf57" title="输出strOutLevel.">out</a>(<a class="code" href="BlockOuter_8cpp.html#796553ecbddff06faececc134af21255">STRING_TABLE_LINE</a>); <a class="code" href="classWLog_1_1RegularOuter.html#2b3bb8587520e12feab2072a85967f89" title="输出换行符.">outendl</a>(); 
<a name="l00033"></a>00033             <a class="code" href="classWLog_1_1RegularOuter.html#00bb054fa8cf40d3d2d32ba4c7cfbf57" title="输出strOutLevel.">out</a>(<a class="code" href="BlockOuter_8cpp.html#64dcd5d298e2263fdcfebad75e3edb98">STRING_TABLE_START</a>);
<a name="l00034"></a>00034             <a class="code" href="classWLog_1_1RegularOuter.html#37a407946531e8fa02c5d70fe5144432">m_out</a>.width(20);<a class="code" href="classWLog_1_1RegularOuter.html#37a407946531e8fa02c5d70fe5144432">m_out</a>.setf(std::ios::left);
<a name="l00035"></a>00035             <a class="code" href="classWLog_1_1RegularOuter.html#00bb054fa8cf40d3d2d32ba4c7cfbf57" title="输出strOutLevel.">out</a>(pLevel-&gt;<a class="code" href="classWLog_1_1ILevel.html#4e06cea4bbd31aae2a9170b24e7d6657" title="得到当前Log的名称.">getName</a>());
<a name="l00036"></a>00036         }
<a name="l00037"></a>00037         <span class="keywordflow">if</span> (pLevel-&gt;<a class="code" href="classWLog_1_1ILevel.html#86121504cef5e39ec3425376dd10ceeb" title="是否要输出“日志记录时间”">bOutTime</a>())
<a name="l00038"></a>00038         {
<a name="l00039"></a>00039             <a class="code" href="classWLog_1_1RegularOuter.html#00bb054fa8cf40d3d2d32ba4c7cfbf57" title="输出strOutLevel.">out</a>(<a class="code" href="BlockOuter_8cpp.html#c97b2122efd444cce5f6fb8debc14eed">STRING_TABLE_SPLIT</a>);
<a name="l00040"></a>00040             <a class="code" href="classWLog_1_1RegularOuter.html#00bb054fa8cf40d3d2d32ba4c7cfbf57" title="输出strOutLevel.">out</a>(pRecord-&gt;<a class="code" href="classWLog_1_1Record.html#0d907faeee2f24237aa9991b4e0a7d00">m_strTime</a>);
<a name="l00041"></a>00041             <a class="code" href="classWLog_1_1RegularOuter.html#2b3bb8587520e12feab2072a85967f89" title="输出换行符.">outendl</a>();
<a name="l00042"></a>00042         }
<a name="l00043"></a>00043         
<a name="l00044"></a>00044         <span class="keywordflow">if</span> (pLevel-&gt;<a class="code" href="classWLog_1_1ILevel.html#1f6651825c0af325a2f909b12b8857de" title="是否要输出“方法名”">bOutFuncName</a>())
<a name="l00045"></a>00045         {
<a name="l00046"></a>00046             <a class="code" href="classWLog_1_1RegularOuter.html#00bb054fa8cf40d3d2d32ba4c7cfbf57" title="输出strOutLevel.">out</a>(<a class="code" href="BlockOuter_8cpp.html#64dcd5d298e2263fdcfebad75e3edb98">STRING_TABLE_START</a>);
<a name="l00047"></a>00047             <a class="code" href="classWLog_1_1RegularOuter.html#37a407946531e8fa02c5d70fe5144432">m_out</a>.width(20);
<a name="l00048"></a>00048             <a class="code" href="classWLog_1_1RegularOuter.html#00bb054fa8cf40d3d2d32ba4c7cfbf57" title="输出strOutLevel.">out</a>(pRecord-&gt;<a class="code" href="classWLog_1_1Record.html#d6768f917f2ea19f11e5c0177cb725a6">m_strFuncName</a>);
<a name="l00049"></a>00049         }
<a name="l00050"></a>00050         <span class="keywordflow">if</span> (pLevel-&gt;<a class="code" href="classWLog_1_1ILevel.html#fdc93101a0cba201cf5dcdf6183a74a2" title="是否要输出“行号”">bOutLineNo</a>())
<a name="l00051"></a>00051         {
<a name="l00052"></a>00052             <a class="code" href="classWLog_1_1RegularOuter.html#00bb054fa8cf40d3d2d32ba4c7cfbf57" title="输出strOutLevel.">out</a>(<a class="code" href="BlockOuter_8cpp.html#c97b2122efd444cce5f6fb8debc14eed">STRING_TABLE_SPLIT</a>);
<a name="l00053"></a>00053             <a class="code" href="classWLog_1_1RegularOuter.html#00bb054fa8cf40d3d2d32ba4c7cfbf57" title="输出strOutLevel.">out</a>(<span class="stringliteral">"(line): "</span>);
<a name="l00054"></a>00054             <a class="code" href="classWLog_1_1RegularOuter.html#00bb054fa8cf40d3d2d32ba4c7cfbf57" title="输出strOutLevel.">out</a>(<a class="code" href="namespaceWLog.html#e03867cb6729e5290f99dd0198c665ab">l2str</a>(pRecord-&gt;<a class="code" href="classWLog_1_1Record.html#7799d7fa2aaddb66821bf5abad26938e">m_nLine</a>));
<a name="l00055"></a>00055             <a class="code" href="classWLog_1_1RegularOuter.html#2b3bb8587520e12feab2072a85967f89" title="输出换行符.">outendl</a>();
<a name="l00056"></a>00056         }
<a name="l00057"></a>00057 
<a name="l00058"></a>00058         <span class="keywordflow">if</span> (pLevel-&gt;<a class="code" href="classWLog_1_1ILevel.html#83164649d0ca90645038df2e05f1843a" title="是否要输出“文件名”">bOutFileName</a>())
<a name="l00059"></a>00059         {
<a name="l00060"></a>00060             <a class="code" href="classWLog_1_1RegularOuter.html#00bb054fa8cf40d3d2d32ba4c7cfbf57" title="输出strOutLevel.">out</a>(<a class="code" href="BlockOuter_8cpp.html#64dcd5d298e2263fdcfebad75e3edb98">STRING_TABLE_START</a>);            
<a name="l00061"></a>00061             <a class="code" href="classWLog_1_1RegularOuter.html#00bb054fa8cf40d3d2d32ba4c7cfbf57" title="输出strOutLevel.">out</a>(pRecord-&gt;<a class="code" href="classWLog_1_1Record.html#d82ac9e750430e01f1895186a8cc70bf">m_strFileName</a>);
<a name="l00062"></a>00062             <a class="code" href="classWLog_1_1RegularOuter.html#2b3bb8587520e12feab2072a85967f89" title="输出换行符.">outendl</a>();
<a name="l00063"></a>00063         }
<a name="l00064"></a>00064 
<a name="l00065"></a>00065         <span class="keywordflow">if</span> (pLevel-&gt;<a class="code" href="classWLog_1_1ILevel.html#fdc93101a0cba201cf5dcdf6183a74a2" title="是否要输出“行号”">bOutLineNo</a>())
<a name="l00066"></a>00066         {
<a name="l00067"></a>00067             <a class="code" href="classWLog_1_1RegularOuter.html#00bb054fa8cf40d3d2d32ba4c7cfbf57" title="输出strOutLevel.">out</a>(<a class="code" href="BlockOuter_8cpp.html#64dcd5d298e2263fdcfebad75e3edb98">STRING_TABLE_START</a>);
<a name="l00068"></a>00068             <a class="code" href="classWLog_1_1RegularOuter.html#00bb054fa8cf40d3d2d32ba4c7cfbf57" title="输出strOutLevel.">out</a>(<span class="stringliteral">"(message): "</span>);
<a name="l00069"></a>00069         }
<a name="l00070"></a>00070 
<a name="l00071"></a>00071         <a class="code" href="classWLog_1_1RegularOuter.html#00bb054fa8cf40d3d2d32ba4c7cfbf57" title="输出strOutLevel.">out</a>(pRecord-&gt;<a class="code" href="classWLog_1_1Record.html#ba5c5b6680a63585eca4644c66e4680b">m_strMsg</a>);
<a name="l00072"></a>00072 
<a name="l00073"></a>00073         <span class="keywordflow">if</span> (pLevel-&gt;<a class="code" href="classWLog_1_1ILevel.html#4c1def9de4e28f9a29a02dead8824a9f" title="是否在消息输出后输出“新行”">bNewLine</a>())
<a name="l00074"></a>00074         {       
<a name="l00075"></a>00075             <a class="code" href="classWLog_1_1RegularOuter.html#2b3bb8587520e12feab2072a85967f89" title="输出换行符.">outendl</a>();
<a name="l00076"></a>00076             <a class="code" href="classWLog_1_1RegularOuter.html#00bb054fa8cf40d3d2d32ba4c7cfbf57" title="输出strOutLevel.">out</a>(<a class="code" href="BlockOuter_8cpp.html#796553ecbddff06faececc134af21255">STRING_TABLE_LINE</a>);<a class="code" href="classWLog_1_1RegularOuter.html#2b3bb8587520e12feab2072a85967f89" title="输出换行符.">outendl</a>();
<a name="l00077"></a>00077             <a class="code" href="classWLog_1_1RegularOuter.html#2b3bb8587520e12feab2072a85967f89" title="输出换行符.">outendl</a>();
<a name="l00078"></a>00078         }
<a name="l00079"></a>00079 
<a name="l00080"></a>00080         <span class="keywordflow">return</span> pLevel-&gt;<a class="code" href="classWLog_1_1ILevel.html#ff3a60a5f597e84874c9f95adc34100e" title="回调函数，在输出后调用，对此级别Log作善后处理.">callBack_AfterOut</a>(pRecord, <span class="keyword">this</span>);
<a name="l00081"></a>00081     }
<a name="l00082"></a>00082 }
</pre></div></div>
<hr>
<address style="align: right;">
  Generated on Mon Apr 6 21:08:12 2009 for WLog by 韦体东<img src="logo.png" align="middle"/></address>
</body>
</html>
